import App from '../app'
// import Vue from 'vue'
// import VueRouter from 'vue-router'
import store from 'store'
Vue.use(VueRouter)


/**
 * requireAuth true登录才能访问，false不需要登录，默认true
 */
let routes = [{
    path: '/',
    component: App,
    children: [
        {
            path: '/homeIndex',
            name: 'homeIndex',
            redirect: '/home',
            component: resolve => require(['@/home/home'], resolve),
            children: [
                {
                    path: '/home',
                    name: 'home',
                    component: resolve => require(['@/home/index'], resolve),
                    meta: {
                        title: '铺连铺',
                        requireAuth: false
                    }
                },
                {
                    path: '/goods',
                    name: 'goods',
                    component: resolve => require(['@/goods/index'], resolve),
                    meta: {
                        title: '全部商品',
                        requireAuth: false
                    }
                },
                /*{
                    path: '/collage',
                    name: 'collage',
                    component: resolve => require(['@/collage/index'], resolve),
                    meta: {
                        title: '拼购',
                        requireAuth: false
                    }
                },*/
                {
                    path: '/my',
                    name: 'my',
                    component: resolve => require(['@/my/index'], resolve),
                    meta: {
                        title: '我的',
                        requireAuth: false
                    }
                },
                {
                    path: '/signout', //商+lianmeng
                    component: resolve => require(['../pages/signout/'], resolve),
                    meta: {
                        requireAuth: false,
                        title: "商+联盟"
                    }
                },
              {
                path: '/chinaGoods',
                component: resolve => require(['../pages/home/chinaGoods'], resolve),
                meta: {
                  requireAuth: false,
                  title: "中国好物"
                }
              }

            ]
        },
      {
        path: '/collage',
        name: 'collage',
        component: resolve => require(['@/collage/index'], resolve),
        meta: {
          title: '拼购',
          requireAuth: false
        }
      },
        {
            path: '/shopCart',
            name: 'shopCart',
            component: resolve => require(['@/shopCart/index'], resolve),
            meta: {
                title: '购物车',
                requireAuth: true
            }
        },
        {
            path: '/my/information',
            name: 'information',
            component: resolve => require(['@/my/information'], resolve),
            meta: {
                title: '个人资料',
                requireAuth: false
            }
        },
        {
            path: '/home/product_details',
            name: 'product_details',
            component: resolve => require(['@/goods/product_details'], resolve),
            meta: {
                title: '商品详情',
                requireAuth: false
            }
        },
        {
            path: '/home/notification',
            name: 'notification',
            component: resolve => require(['@/Collage/notification'], resolve),
            meta: {
                title: '消息通知',
                requireAuth: true
            }
        },
        {
            path: '/home/notice',
            name: 'notice',
            component: resolve => require(['@/Collage/notice'], resolve),
            meta: {
                title: '消息通知',
                requireAuth: true,
            }
        },
        {
            path: '/collage/classify',
            name: 'classify',
            component: resolve => require(['@/Collage/classify'], resolve),
            meta: {
                title: '分类详情',
                requireAuth: false
            }
        },
        {
            path: '/collage/join',
            name: 'collage_join',
            component: resolve => require(['@/Collage/join'], resolve),
            meta: {
                title: '拼单等待',
                requireAuth: false
            }
        },
        {
            path: '/collage/wait',
            name: 'collage_wait',
            component: resolve => require(['@/Collage/wait'], resolve),
            meta: {
                title: '拼单等待',
                requireAuth: true
            }
        },
        {
            path: '/collage/result',
            name: 'collage_result',
            component: resolve => require(['@/Collage/result'], resolve),
            meta: {
                title: '拼单等待',
                requireAuth: true
            }
        },
        {
            path: '/home/evaluation',
            name: 'evaluationList',
            component: resolve => require(['@/goods/evaluation'], resolve),
            meta: {
                title: '商品评价',
                requireAuth: false
            }
        },
        {
            path: '/home/search',
            name: 'searchs',
            component: resolve => require(['@/goods/search'], resolve),
            meta: {
                title: '搜索',
                requireAuth: false
            }
        },
        {
            path: '/home/subOrder',
            name: 'subOrder',
            component: resolve => require(['@/goods/subOrder'], resolve),
            meta: {
                title: '订单支付',
                requireAuth: true
            }
        },
        {
            path: '/home/collage_subOrder',
            name: 'collage_subOrder',
            component: resolve => require(['@/goods/collage_subOrder'], resolve),
            meta: {
                title: '订单支付',
                requireAuth: true
            }
        },
        {
            path: '/home/paySuc',
            name: 'paySuc',
            component: resolve => require(['@/goods/paySuc'], resolve),
            meta: {
                title: '支付成功',
                requireAuth: true
            }
        },
        {
            path: '/order',
            name: 'order',
            component: resolve => require(['@/order/index'], resolve),
            meta: {
                title: '我的订单',
                requireAuth: true
            }
        },
        {
            path: '/order/detail',
            name: 'orderDetail',
            component: resolve => require(['@/order/order_details'], resolve),
            meta: {
                title: '订单详情',
                requireAuth: true
            }
        },
        {
            path: '/order/wuliu',
            name: 'wuliu',
            component: resolve => require(['@/order/wuliu'], resolve),
            meta: {
                title: '物流信息',
                requireAuth: true
            }
        },
        {
            path: '/order/modify_address',
            name: 'wuliu',
            component: resolve => require(['@/order/modify_address'], resolve),
            meta: {
                title: '修改收货地址',
                requireAuth: true
            }
        },
        {
            path: '/order/exchange',    //  退货/换货
            name: 'exchange',
            component: resolve => require(['@/order/exchange'], resolve),
            meta: {
                title: '退换/售后',
                requireAuth: true
            }
        },
        {
            path: '/order/application_exchange',   //  退货/换货申请
            name: 'application_exchange',
            component: resolve => require(['@/order/application_exchange'], resolve),
            meta: {
                title: '退换/售后',
                requireAuth: true
            }
        },
        {
             path: '/order/customer_service',   //  售后服务
             name: 'customer_service',
             component: resolve => require(['@/order/customer_service'], resolve),
             meta: {
                title: '退换/售后',
                requireAuth: true
             }
        },
        {
             path: '/order/customer_service/detail',   //  售后详情
             name: 'customer_service_detail',
             component: resolve => require(['@/order/customer_service_detail'], resolve),
             meta: {
                title: '退换/售后',
                requireAuth: true
             }
        },
        {
             path: '/order/logistics_number',  //  填写物流单号
             name: 'logistics_number',
             component: resolve => require(['@/order/logistics_number'], resolve),
             meta: {
                title: '退换/售后',
                requireAuth: true
             }
        },
        {
             path: '/order/complaint',  //  填写物流单号
             name: 'logistics_number',
             component: resolve => require(['@/order/complaint'], resolve),
             meta: {
                title: '投诉',
                requireAuth: true
             }
        },
        {
            path: '/order/evaluation',
            name: 'evaluation',
            component: resolve => require(['@/order/evaluation'], resolve),
            meta: {
                title: '评价',
                requireAuth: true
            }
        },
        {
            path: '/my/profit',
            component: resolve => require(['@/my/profit'], resolve),
            meta: {
                title: '我的收益',
                requireAuth: true
            }
        },
        {
            path: '/my/profit_detail',
            component: resolve => require(['@/my/profit_detail'], resolve),
            meta: {
                title: '收益详情',
                requireAuth: true
            }
        },
        {
            path: '/my/wallet',
            component: resolve => require(['@/my/wallet'], resolve),
            meta: {
                title: '我的钱包',
                requireAuth: true
            }
        },
        {
            path: '/my/red_packets',
            component: resolve => require(['@/my/red_packets'], resolve),
            meta: {
                title: '我的红包',
                requireAuth: true
            }
        },
        {
            path: '/my/coupon',
            component: resolve => require(['@/my/coupon'], resolve),
            meta: {
                title: '我的优惠券',
                requireAuth: true
            }
        },
        {
            path: '/my/address',
            component: resolve => require(['@/my/address'], resolve),
            meta: {
                title: '我的收货地址',
                requireAuth: true
            }
        },
        {
            path: '/my/addAddress',
            component: resolve => require(['@/my/addAddress'], resolve),
            meta: {
                title: '添加收货地址',
                requireAuth: true
            }
        },
        {
            path: '/my/selectAddress',
            component: resolve => require(['@/my/selectAddress'], resolve),
            meta: {
                title: '选择收货地址',
                requireAuth: true
            }
        },
        {
            path: '/my/before_changePw',
            component: resolve => require(['@/my/before_changePw'], resolve),
            meta: {
                title: '修改支付密码',
                requireAuth: true
            }
        },
        {
            path: '/my/modify_pw',
            component: resolve => require(['@/my/modify_pw'], resolve),
            meta: {
                title: '修改支付密码',
                requireAuth: true
            }
        },
        {
            path: '/my/pay_pw',
            component: resolve => require(['@/my/pay_pw_old'], resolve),
            meta: {
                title: '我的支付密码',
                requireAuth: true
            }
        },
        {
            path: '/my/pw',
            component: resolve => require(['@/my/pw'], resolve),
            meta: {
                title: '设置登录密码',
                requireAuth: true
            }
        },
        {
            path: '/my/baby',
            component: resolve => require(['@/my/baby'], resolve),
            meta: {
                title: '我的宝呗',
                requireAuth: true
            }
        },
        {
            path: '/my/baby/total', //  宝呗总量
            component: resolve => require(['../pages/baby/babyTotal.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "宝呗总量"
            }
        },
        {
            path: '/my/baby/baby_detail', //  宝呗明细
            component: resolve => require(['../pages/baby/baby_detail.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "宝呗明细"
            }
        },
        {
            path: '/my/baby/babyBuy', //  宝呗明细
            component: resolve => require(['../pages/baby/babyBuy.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "宝呗购买"
            }
        },
        {
            path: '/my/baby/buyok', //  宝呗明细
            component: resolve => require(['../pages/baby/buyok.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "成功购买"
            }
        },
        {
            path: '/my/baby/transfer', //  宝呗转让
            component: resolve => require(['../pages/baby/transfer.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "宝呗转让"
            }
        },
        {
            path: '/my/baby/babyAdded', //  宝呗转让
            component: resolve => require(['../pages/baby/babyAdded.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "实时增值"
            }
        },
        {
            path: '/my/baby/babyPut', //  宝呗提现到余额
            component: resolve => require(['../pages/baby/babyPut.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "宝呗收益"
            }
        },
        {
            path: '/my/baby/income_detail', //  宝呗转让
            component: resolve => require(['../pages/baby/income_detail.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "宝呗收益明细"
            }
        },
        {
            path: '/my/signIn',
            component: resolve => require(['@/my/signIn'], resolve),
            meta: {
                title: '签到中心',
                requireAuth: true
            }
        },
        {
            path: '/my/integral_detail',
            component: resolve => require(['@/my/integral_detail'], resolve),
            meta: {
                title: '积分明细',
                requireAuth: true
            }
        },
        {
            path: '/my/bill',
            component: resolve => require(['@/my/bill'], resolve),
            meta: {
                title: '我的账单',
                requireAuth: true
            }
        },
        {
            path: '/my/bill/billinfo',
            component: resolve => require(['@/my/billInfo'], resolve),
            meta: {
                title: '我的账单',
                requireAuth: true
            }
        },
        {
            path: '/my/refree',
            component: resolve => require(['@/my/refree'], resolve),
            meta: {
                title: '填写推荐人',
                requireAuth: true
            }
        },
        {
            path: '/my/priority_voucher',
            component: resolve => require(['@/my/priority'], resolve),
            meta: {
                title: '我的优先券',
                requireAuth: true
            }
        },
        {
            path: '/priority/priority_list',
            component: resolve => require(['@/priority/index'], resolve),
            meta: {
                title: '我的优先券',
                requireAuth: true
            }
        },
        {
            path: '/priority/noUsepriority',
            component: resolve => require(['@/priority/noUsePriority'], resolve),
            meta: {
                title: '失效优先券',
                requireAuth: true
            }
        },
        {
            path: '/priority/transfer',
            component: resolve => require(['@/priority/transfer'], resolve),
            meta: {
                title: '优先券转让',
                requireAuth: true
            }
        },
        {
            path: '/priority/transferC',
            component: resolve => require(['@/priority/transferC'], resolve),
            meta: {
                title: '优先券转让',
                requireAuth: true
            }
        },
        {
            path: '/priority/consumer_detail',
            component: resolve => require(['@/priority/detail'], resolve),
            meta: {
                title: '消费详情',
                requireAuth: true
            }
        },
        {
            path: '/my/shop',
            component: resolve => require(['@/my/shop'], resolve),
            meta: {
                title: '我的店铺',
                requireAuth: true
            }
        },
        {
            path: '/my/verified',
            component: resolve => require(['@/my/verified'], resolve),
            meta: {
                title: '实名认证',
                requireAuth: true
            }
        },
        //  店铺
        {
            path: '/my/shop/rentshop',  //  租店
            component: resolve => require(['@/shop/rent_shop'], resolve),
            meta: {
                title: '我的店铺',
                requireAuth: true
            }
        },
        {
            path: '/my/shop/retire',
            component: resolve => require(['@/shop/retire'], resolve),
            meta: {
                title: '店铺简介',
                requireAuth: true
            }
        },
        {
            path: '/my/shop/refund',
            component: resolve => require(['@/shop/refund'], resolve),
            meta: {
                title: '租金退款',
                requireAuth: true
            }
        },
        {
            path: '/my/shop/rentpay',  //  租店支付方式
            component: resolve => require(['@/shop/rent_pay'], resolve),
            meta: {
                title: '我的店铺',
                requireAuth: true
            }
        },
        {
            path: '/my/shop/lineup_num',  //  当前排队人数  点击   支付额度
            component: resolve => require(['@/shop/lineUp_num'], resolve),
            meta: {
                title: '我的店铺',
                requireAuth: true
            }
        },
        {
            path: '/my/shop/setpay',  //  开店额度支付方式   和rentpay共享css
            component: resolve => require(['@/shop/set_pay'], resolve),
            meta: {
                title: '我的店铺',
                requireAuth: true
            }
        },
        {
            path: '/my/shop/lineup',  //  排队页面
            component: resolve => require(['@/shop/lineUp'], resolve),
            meta: {
                title: '我的店铺',
                requireAuth: true
            }
        },
        {
            path: '/my/shop/details',  //  店铺或者租仓详情
            component: resolve => require(['@/shop/shop_details'], resolve),
            meta: {
                title: '我的店铺',
                requireAuth: true
            }
        },
        {
            path: '/my/shop/close',  //  店铺或者租仓详情
            component: resolve => require(['@/shop/shop_close'], resolve),
            meta: {
                title: '我的店铺',
                requireAuth: true
            }
        },
        //   钱包
        {
            path: '/my/wallet/detail',
            component: resolve => require(['@/wallet/detail'], resolve),
            meta: {
                title: '余额明细',
                requireAuth: true
            }
        },
        {
            path: '/my/wallet/rechange',
            component: resolve => require(['@/wallet/rechange'], resolve),
            meta: {
                title: '余额充值',
                requireAuth: true
            }
        },
        {
            path: '/my/wallet/withdraw',
            component: resolve => require(['@/wallet/withdraw'], resolve),
            meta: {
                title: '余额提现',
                requireAuth: true
            }
        },
        {
            path: '/my/wallet/withSuc',
            component: resolve => require(['@/wallet/withSuc'], resolve),
            meta: {
                title: '提现成功',
                requireAuth: true
            }
        },
        {
            path: '/my/wallet/transfer',
            component: resolve => require(['@/wallet/transfer'], resolve),
            meta: {
                title: '余额转让',
                requireAuth: true
            }
        },
        {
            path: '/my/wallet/transferC',
            component: resolve => require(['@/wallet/transferC'], resolve),
            meta: {
                title: '余额转让',
                requireAuth: true
            }
        },
        {
            path: '/my/wallet/alipay',
            component: resolve => require(['@/wallet/alipay'], resolve),
            meta: {
                title: '绑定支付宝账号',
                requireAuth: true
            }
        },
        {
            path: '/success',
            component: resolve => require(['@/my/SuccessPage'], resolve),
            meta: {
                title: '认证成功',
                requireAuth: true
            }
        },
        {
            path: '/my/verifiedStatus',
            component: resolve => require(['@/my/SuccessPage'], resolve),
            meta: {
                title: '认证成功',
                requireAuth: true
            }
        },
        {
            path: '/bindingPhone',
            component: resolve => require(['@/my/bindingPhone'], resolve),
            meta: {
                title: '手机号绑定',
                requireAuth: true
            }
        },
        {
            path: '/RechargeMethod',
            component: resolve => require(['@/wallet/RechargeMethod'], resolve),
            meta: {
                title: '余额充值',
                requireAuth: true
            }
        },
        {
            path: '/PresentationMode',
            component: resolve => require(['@/wallet/PresentationMode'], resolve),
            meta: {
                title: '余额提现',
                requireAuth: true
            }
        },
        {
            path: '/AccountInformation',
            component: resolve => require(['@/wallet/AccountInformation'], resolve),
            meta: {
                title: '账户信息',
                requireAuth: true
            }
        },
        {
            path: '/UnderLineRecharge',
            component: resolve => require(['@/wallet/UnderLineRecharge'], resolve),
            meta: {
                title: '线下充值',
                requireAuth: true
            }
        },
        {
            path: '/my/bankCard',
            component: resolve => require(['@/bankCard/'], resolve),
            meta: {
                title: '我的银行卡',
                requireAuth: true
            }
        },
        {
            path: '/my/addBankCard',
            component: resolve => require(['@/bankCard/addBankCard'], resolve),
            meta: {
                title: '添加银行卡',
                requireAuth: true
            }
        },
        {
            path: '/my/bankCardInfo',
            component: resolve => require(['@/bankCard/bankInfo'], resolve),
            meta: {
                title: '我的银行卡',
                requireAuth: true
            }
        },
        {
            path: '/offlinePresentation',
            component: resolve => require(['@/bankCard/offlinePresentation'], resolve),
            meta: {
                title: '线下提现',
                requireAuth: true
            }
        },
        {
            path: '/handbook',  // 使用手册
            component: resolve => require(['../pages/my/handBook'], resolve),
            meta: {
                requireAuth: false,
                title: '使用手册',

            }
        },
        {
            path: '/news',  // 历史记录
            component: resolve => require(['../pages/my/news'], resolve),
            meta: {
                requireAuth: false,
                title: '历史记录',

            }
        },
        {
            path: '/news/oneNews',  // 历史记录
            component: resolve => require(['../pages/my/oneNews'], resolve),
            meta: {
                requireAuth: false,
                title: '历史记录',

            }
        },
        {
            path: '/agreement',  // 用户协议
            component: resolve => require(['../pages/my/agreement'], resolve),
            meta: {
                requireAuth: false,
                title: '用户协议',
            }
        },
        {
            path: "/my/business", //商家列表
            component: resolve => require(['../pages/business/business'], resolve),
            meta: {
                requireAuth: true,
                title: '商家列表',
            }
        },
        {
            path: "/my/businessInfo", //商家详情  旧
            component: resolve => require(['../pages/business/businessInfo.vue'], resolve),
            meta: {
                requireAuth: true,
                title: '商家详情',

            }
        },
        {
            path: "/my/business_detail", //商家详情
            component: resolve => require(['../pages/business/business_detail.vue'], resolve),
            meta: {
                requireAuth: true,
                title: '门店信息',

            }
        },
        {
            path: "/my/business/select_time", //商家详情
            component: resolve => require(['../pages/business/selectTime.vue'], resolve),
            meta: {
                requireAuth: true,
                title: '设置营业时间',

            }
        },
        {
            path: "/my/business_sign", //商家详情
            component: resolve => require(['../pages/business/business_sign.vue'], resolve),
            meta: {
                requireAuth: true,
                title: '门店信息',

            }
        },
        {
            path: "/my/business/addBusiness", //添加商家
            component: resolve => require(['../pages/business/addBusiness.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "添加商家"
            }
        },
        {
            path: "/my/business/addBusinessInfo", //填写商家信息
            component: resolve => require(['../pages/business/addBusinessInfo.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "添加商家信息"
            }
        },
        {
            path: "/my/business/businessVerified", //商家实名认证
            component: resolve => require(['../pages/business/businessVerified.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "商家实名认证"
            }
        },
        {
            path: "/my/business/businessLicense", //商家上传营业执照
            component: resolve => require(['../pages/business/businessLicense.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "商家上传营业执照"
            }
        },
        {
            path: "/shop/rentalAgreement", //商家上传营业执照
            component: resolve => require(['../pages/shop/rentalAgreement'], resolve),
            meta: {
                requireAuth: true,
                title: "租店协议"
            }
        },
        {
            path: "/shop/selectShopPrice", //商家价格选择
            component: resolve => require(['../pages/shop/selectShopPrice'], resolve),
            meta: {
                requireAuth: true,
                title: "我的店铺"
            }
        },
        {
            path: '/signout/recom_detail', //推荐详情页
            component: resolve => require(['../pages/signout/recom_detail.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "商+联盟"
            }
        },
        {
            path: '/signout/merchant_recom', //商家推荐
            component: resolve => require(['../pages/signout/merchant_recom.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "商家推荐"
            }
        },
        // TODO   zanshi 不用  走商品评价
        {
            path: '/signout/evaluate',
            component: resolve => require(['../pages/signout/evaluate.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "写评价"
            }
        },
        {
            path: '/signout/evaluation',
            component: resolve => require(['../pages/signout/evaluation.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "网友点评"
            }
        },
        {
            path: '/signout/merchant_r_d', //商家推荐详情
            component: resolve => require(['../pages/signout/merchant_r_d.vue'], resolve),
            meta: {
                requireAuth: false,
                title: ""
            }
        },
        {
            path: '/signout/confirm_pay', //确认支付
            component: resolve => require(['../pages/signout/confirm_pay.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "付款"
            }
        },
        {
            path: '/signout/pay_money', //确认支付
            component: resolve => require(['../pages/signout/pay_money.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "付款"
            }
        },
        {
            path: '/signout/purchase_detail', //推荐支付页
            component: resolve => require(['../pages/signout/purchase_detail.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "付款"
            }
        },
        {
            path: '/signout/map', //确认支付
            component: resolve => require(['../pages/signout/business_map.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "商+联盟"
            }
        },
      {
        path: '/signout/address', //确认支付
        component: resolve => require(['../pages/signout/address.vue'], resolve),
        meta: {
          requireAuth: false,
          title: "选择地区"
        }
      },
        {
            path: '/down', //下载也
            component: resolve => require(['../pages/down/downios.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "铺连铺"
            }
        },
        {
            path: '/my/client', //我的客户
            component: resolve => require(['../pages/my/client.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "我的客户"
            }
        },
        //    修改用户信息
        {
            path: '/modify/modify_name', //  修改昵称
            component: resolve => require(['../pages/modify/modify_name.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "修改昵称"
            }
        },
        {
            path: '/modify/application', //  提交申请书
            component: resolve => require(['../pages/modify/application.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "申请书"
            }
        },
        {
            path: '/modify/modify_suc', //  提交申请成功
            component: resolve => require(['../pages/modify/modify_suc.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "提交成功"
            }
        },
        {
            path: '/modify/new_pay_pw', //  新支付密码
            component: resolve => require(['../pages/modify/new_pay_pw.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "新支付密码"
            }
        },
        {
            path: '/modify/new_phone', //  新手机号
            component: resolve => require(['../pages/modify/new_phone.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "新手机号"
            }
        },
        {
            path: '/modify/new_pw', //  新密码
            component: resolve => require(['../pages/modify/new_pw.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "新密码"
            }
        },
        {
            path: '/modify/new_verified', //  新实名认证信息
            component: resolve => require(['../pages/modify/new_verified.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "新实名认证信息"
            }
        },
        {
            path: '/modify/old_pay_pw', //  旧支付密码
            component: resolve => require(['../pages/modify/old_pay_pw.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "旧支付密码"
            }
        },
        {
            path: '/modify/old_phone', //  旧手机号
            component: resolve => require(['../pages/modify/old_phone.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "旧手机号"
            }
        },
        {
            path: '/modify/old_pw', //  旧密码
            component: resolve => require(['../pages/modify/old_pw.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "旧密码"
            }
        },
        {
            path: '/modify/old_verified', //  旧实名信息
            component: resolve => require(['../pages/modify/old_verified.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "旧实名信息"
            }
        },
        {
            path: '/activity', //  旧实名信息
            component: resolve => require(['../pages/home/activity.vue'], resolve),
            meta: {
                requireAuth: false,
                title: "活动页面"
            }
        },
        {
            path: '/experienceStore',
            component: resolve => require(['../pages/experienceStore/'], resolve),
            meta: {
                requireAuth: false,
                title: "我的体验店"
            }
        },
        {
            path: '/experienceStore/profit',
            component: resolve => require(['../pages/experienceStore/profit'], resolve),
            meta: {
                requireAuth: true,
                title: "收益区"
            }
        },
        {
            path: '/experienceStore/profit_detail',
            component: resolve => require(['../pages/experienceStore/profit_detail'], resolve),
            meta: {
                requireAuth: true,
                title: "收益详情"
            }
        },
        {
            path: '/proxyProfit',
            component: resolve => require(['../pages/experienceStore/proxy_profit'], resolve),
            meta: {
                requireAuth: true,
                title: "代理收益"
            }
        },
        //  为小程序提供内嵌h5
        {
            path: '/program/signin',
            component: resolve => require(['../program/signIn'], resolve),
            meta: {
                requireAuth: false,
                title: "签到中心"
            }
        },
        {
            path: '/program/integral_detail',
            component: resolve => require(['../program/integral_detail'], resolve),
            meta: {
                requireAuth: false,
                title: "积分明细"
            }
        },
        {
            path: '/my/gems',
            component: resolve => require(['@/gems/index'], resolve),
            meta: {
                requireAuth: true,
                title: "我的宝石券"
            }
        },
        {
            path: '/my/gems/detail',
            component: resolve => require(['@/gems/detail'], resolve),
            meta: {
                requireAuth: true,
                title: "宝石券明细"
            }
        },
        {
            path: '/my/gems/wait_detail',
            component: resolve => require(['@/gems/waitDetail'], resolve),
            meta: {
                requireAuth: true,
                title: "待结算明细"
            }
        },
        {
            path: '/my/gems/transfer',
            component: resolve => require(['@/gems/transfer'], resolve),
            meta: {
                requireAuth: true,
                title: "宝石券转让"
            }
        },
        {
            path: '/my/gems/transferC',
            component: resolve => require(['@/gems/transferC'], resolve),
            meta: {
                requireAuth: true,
                title: "宝石券转让"
            }
        },
        {
            path: '/my/gems/tradeBank',
            component: resolve => require(['@/gems/tradeBank'], resolve),
            meta: {
                requireAuth: true,
                title: "交易行"
            }
        },
        {
            path: '/my/gems/gemsBuy',
            component: resolve => require(['@/gems/gemsBuy'], resolve),
            meta: {
                requireAuth: true,
                title: "宝石券购买"
            }
        },
        {
            path: '/my/gems/onshelflist',
            component: resolve => require(['@/gems/onShelfList'], resolve),
            meta: {
                requireAuth: true,
                title: "宝石券上架"
            }
        },
        {
            path: '/my/gems/onshelf',
            component: resolve => require(['@/gems/onShelf'], resolve),
            meta: {
                requireAuth: true,
                title: "宝石券上架"
            }
        },
        {
            path: '/my/gems/shopping_card',
            component: resolve => require(['@/gems/shoppingCard'], resolve),
            meta: {
                requireAuth: true,
                title: "购物卡"
            }
        },
        //  供应商开店申请
        {
            path: '/supplier/first_step',
            component: resolve => require(['@/supplierShop/first_step'], resolve),
            meta: {
                requireAuth: true,
                title: "申请开店第一步"
            }
        },{
            path: '/supplier/second_step',
            component: resolve => require(['@/supplierShop/second'], resolve),
            meta: {
                requireAuth: true,
                title: "申请开店第二步"
            }
        },
        {
            path: '/supplier/thrid_step',
            component: resolve => require(['@/supplierShop/thrid_step'], resolve),
            meta: {
                requireAuth: true,
                title: "申请开店第三步"
            }
        },
        {
            path: '/supplier/fourth_step',
            component: resolve => require(['@/supplierShop/fourth_step'], resolve),
            meta: {
                requireAuth: true,
                title: "申请开店第四步"
            }
        },
        {
            path: '/supplier',
            component: resolve => require(['@/supplierShop/'], resolve),
            meta: {
                requireAuth: true,
                title: "申请成功"
            }
        },
        {
            path: '/supplier/agreement',
            component: resolve => require(['@/supplierShop/agreement'], resolve),
            meta: {
                requireAuth: true,
                title: "供应商开店协议"
            }
        },
        {
            path: '/supplier/dilatation',
            component: resolve => require(['@/supplierShop/dilatation'], resolve),
            meta: {
                requireAuth: true,
                title: "扩容"
            }
        },
        //  兑换券
        {
            path: '/my/exchange_voucher',
            component: resolve => require(['@/exchangeVoucher/index'], resolve),
            meta: {
                title: '我的兑换券',
                requireAuth: true
            }
        },
        {
            path: '/exchangeVoucher/usePriority',
            component: resolve => require(['@/exchangeVoucher/usePriority'], resolve),
            meta: {
                title: '我的兑换券',
                requireAuth: true
            }
        },
        {
            path: '/exchangeVoucher/noUsepriority',
            component: resolve => require(['@/exchangeVoucher/noUsePriority'], resolve),
            meta: {
                title: '失效兑换券',
                requireAuth: true
            }
        },
        {
            path: '/exchangeVoucher/use',
            component: resolve => require(['@/exchangeVoucher/use'], resolve),
            meta: {
                title: '我的兑换券',
                requireAuth: true
            }
        },
        {
            path: '/exchangeVoucher/confirm',
            component: resolve => require(['@/exchangeVoucher/confirm'], resolve),
            meta: {
                title: '我的兑换券',
                requireAuth: true
            }
        },
        {
            path: '/exchangeVoucher/consumer_detail',
            component: resolve => require(['@/exchangeVoucher/detail'], resolve),
            meta: {
                title: '消费详情',
                requireAuth: true
            }
        },
        {
            path: '/activity/qixi',
            component: resolve => require(['../pages/activity/qixi'], resolve),
            meta: {
                requireAuth: false,
                title: ""
            }
        },
        {
            path: '/activity/qixiZone',
            component: resolve => require(['../pages/activity/qixiZone'], resolve),
            meta: {
                requireAuth: false,
                title: ""
            }
        },
        {
            path: '/activity/qixiNewZone',
            component: resolve => require(['../pages/activity/qixiNewZone'], resolve),
            meta: {
                requireAuth: false,
                title: ""
            }
        },
        {
            path: '/activity/fan_rank',
            component: resolve => require(['../pages/activity/fanRank'], resolve),
            meta: {
                requireAuth: false,
                title: "个人吸粉排名"
            }
        },
        {
            path: '/activity/rob_gems',
            component: resolve => require(['../pages/activity/robGems'], resolve),
            meta: {
                requireAuth: false,
                title: "整点宝石券限量秒"
            }
        },
        {
            path: '/activity/bannerDetail',
            component: resolve => require(['../pages/activity/bannerDetail'], resolve),
            meta: {
                requireAuth: false,
                title: ""
            }
        },
      {
        path: '/activity/redPacket',
        component: resolve => require(['../pages/activity/redPacket'], resolve),
        meta: {
          requireAuth: false,
          title: "扫码抢红包"
        }
      },
      {
        path: '/activity/midAutumn',
        component: resolve => require(['../pages/activity/midAutumn'], resolve),
        meta: {
          requireAuth: false,
          title: ""
        }
      },
      {
        path: '/activity/cityCall',
        component: resolve => require(['../pages/activity/cityCall'], resolve),
        meta: {
          requireAuth: false,
          title: ""
        }
      },
      {
        path: '/activity/autumnGame',
        component: resolve => require(['../pages/activity/autumnGame'], resolve),
        meta: {
          requireAuth: false,
          title: ""
        }
      },
      {
        path: '/home/homeSort',
        component: resolve => require(['../pages/home/sort'], resolve),
        meta: {
          requireAuth: false,
          title: "分类"
        }
      },
      {
        path: '/activity/eatingGoods',
        component: resolve => require(['../pages/activity/eatingGoods'], resolve),
        meta: {
          requireAuth: false,
          title: ""
        }
      },
        {
            path: '/activity/nationalDay_rank',
            component: resolve => require(['../pages/activity/nationalDay_rank'], resolve),
            meta: {
                requireAuth: false,
                title: "带着国旗去狂欢"
            }
        },
        {
            path: '/activity/couponZone',  // 可领取优惠券  路由配置按钮位置（x,y）
            component: resolve => require(['../pages/activity/couponZone'], resolve),
            meta: {
                requireAuth: false,
                title: ""
            }
        },
        {
            path: '/activity/redEnvelopeRain',  //国庆游戏
            component: resolve => require(['../pages/activity/RedEnvelopeRain'], resolve),
            meta: {
                requireAuth: false,
                title: ""
            }
        },
        {
            path: '/activity/newPeople',  //迎新专区
            component: resolve => require(['../pages/activity/newPeople'], resolve),
            meta: {
                requireAuth: false,
                title: ""
            }
        },
      {
        path: '/activity/newsLottery',  //新人专区
        component: resolve => require(['../pages/activity/NewsLottery'], resolve),
        meta: {
          requireAuth: false,
          title: ""
        }
      },
      {
        path: '/activity/rightTouch',  //百元对对碰
        component: resolve => require(['../pages/activity/rightTouch'], resolve),
        meta: {
          requireAuth: false,
          title: ""
        }
      },
        {
            path: '/activity/shake',  //摇一摇
            component: resolve => require(['../pages/activity/shake'], resolve),
            meta: {
                requireAuth: false,
                title: "霸气取暖摇一摇"
            }
        },
        {
            path: '/activity/collageActivity',  //拼购活动
            component: resolve => require(['../pages/activity/collageActivity'], resolve),
            meta: {
                requireAuth: false,
                title: ""
            }
        },
        {
            path: '/authorization',  //输入授权码
            component: resolve => require(['../pages/authorization/'], resolve),
            meta: {
                requireAuth: false,
                title: "输入授权码"
            }
        },
        {
            path: '/authorization/info',  //授权登录
            component: resolve => require(['../pages/authorization/info'], resolve),
            meta: {
                requireAuth: false,
                title: "授权登录"
            }
        },
        {
            path: '/authorization/mobile',  //手机号更换
            component: resolve => require(['../pages/authorization/mobile'], resolve),
            meta: {
                requireAuth: false,
                title: "输入手机号"
            }
        },
        {
            path: '/authorization/password',  //密码更换
            component: resolve => require(['../pages/authorization/password'], resolve),
            meta: {
                requireAuth: false,
                title: "输入密码"
            }
        },
        {
            path: '/activity/pullNew_rank',  //拉新消费排名
            component: resolve => require(['../pages/activity/pullNew_rank'], resolve),
            meta: {
                requireAuth: false,
                title: "App新人推广"
            }
        },
        {
            path: '/activity/activity_three',  //拉新消费二进一活动
            component: resolve => require(['../pages/activity/activity_three'], resolve),
            meta: {
                requireAuth: false,
                title: ""
            }
        },
        {
            path: '/PresentationMode/detailList',
            component: resolve => require(['@/wallet/presentationModeDetail/index'], resolve),
            meta: {
                title: '提现明细',
                requireAuth: true
            }
        },
        {
            path: '/PresentationMode/detailList/detail',
            component: resolve => require(['@/wallet/presentationModeDetail/detail'], resolve),
            meta: {
                title: '提现详情',
                requireAuth: true
            }
        },
        {
            path: '/video/play',
            component: resolve => require(['@/video/index'], resolve),
            meta: {
                title: '',
                requireAuth: false
            }
        },
        {
            path: '/my/medal',
            component: resolve => require(['@/my/medal'], resolve),
            meta: {
                title: '我的勋章',
                requireAuth: true
            }
        },
        {
            path: '/my/babyWs',
            component: resolve => require(['../pages/baby-ws/index'], resolve),
            meta: {
                title: '我的帅呗',
                requireAuth: true
            }
        },
        {
            path: '/my/babyWs/total', //  帅呗总量
            component: resolve => require(['../pages/baby-ws/babyTotal.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "帅呗总量"
            }
        },
        {
            path: '/my/babyWs/baby_detail', //  帅呗明细
            component: resolve => require(['../pages/baby-ws/baby_detail.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "帅呗明细"
            }
        },
        {
            path: '/my/babyWs/babyBuy', //  帅呗明细
            component: resolve => require(['../pages/baby-ws/babyBuy.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "帅呗购买"
            }
        },
        {
            path: '/my/babyWs/buyok', //  帅呗明细
            component: resolve => require(['../pages/baby-ws/buyok.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "成功购买"
            }
        },
        {
            path: '/my/babyWs/transfer', //  帅呗转让
            component: resolve => require(['../pages/baby-ws/transfer.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "宝呗转让"
            }
        },
        {
            path: '/my/babyWs/babyAdded', //  帅呗增值
            component: resolve => require(['../pages/baby-ws/babyAdded.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "实时增值"
            }
        },
        {
            path: '/my/babyWs/babyPut', //  帅呗提现到余额
            component: resolve => require(['../pages/baby-ws/babyPut.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "宝呗收益"
            }
        },
        {
            path: '/my/babyWs/income_detail', //  宝呗转让
            component: resolve => require(['../pages/baby-ws/income_detail.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "宝呗收益明细"
            }
        },
        {
            path: '/my/wallet/otherAccout', //  宝呗转让
            component: resolve => require(['../pages/wallet/stork/otherAccout.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "股票购买"
            }
        },
        {
            path: '/my/wallet/stork_buy', //  宝呗转让
            component: resolve => require(['../pages/wallet/stork/stork_buy.vue'], resolve),
            meta: {
                requireAuth: true,
                title: "股票购买"
            }
        },
        {
            path: '/signout/confirm_pay/*'
        },
        {
          path: '/activity/redPacket/*',
        },
        {
            path: '/*',
            redirect: '/home'
        }
    ]
}]

const router = new VueRouter({
    routes
})
window.addEventListener('popstate', function (e) {
    router.isBack = true;
}, false)

// let startX, startY, moveEndX, moveEndY, X, Y;

/*window.addEventListener('touchstart', function(e) {
    // e.preventDefault();
    window.localStorage.setItem("move","0")
    startX = e.touches[0].pageX;

    startY = e.touches[0].pageY;

});

//解决IOs左滑右滑手势重新加载过渡动画;
window.addEventListener('touchmove', function(e) {

    // e.preventDefault();

    moveEndX = e.changedTouches[0].pageX;


    X = moveEndX - startX;

    let pageX = document.body.clientWidth * 0.7;

    if ( X > pageX ) {
        window.localStorage.setItem("move","1")
    }

    else if ( X < pageX ) {
        window.localStorage.setItem("move","1")
    }else{
        window.localStorage.setItem("move","0")
    }


});*/

VueRouter.prototype.goBack = function () {
    this.isBack = true
    window.history.go(-1)
}

const nativePage = ['/home', '/chinaGoods', '/goods', '/signout', '/my']
//  拦截
router.beforeEach((to, from, next) => {
    if (to.matched.some(r => r.meta.requireAuth)) {
        if (!Vue.prototype.comJS.getCookie('t')) {
            Vue.prototype.Interactive.pushTokentoJS();
        } else {
            Vue.prototype.comJS.closeAlert()
            if(nativePage.indexOf(to.path) >= 0 && store.state.router.isNewNative){
                Vue.prototype.Interactive.activityWebDismiss()
            }
            next();
        };
    } else {
        Vue.prototype.comJS.closeAlert()
        if(to.path.indexOf('/signout/confirm_pay') > -1 && to.path != '/signout/confirm_pay'){
            if(to.path.indexOf('&from=App') > -1){
                console.dir(Vue)
                var str;
                str = to.path.slice('/signout/confirm_pay'.length + 1, to.path.indexOf('&from=App'))
                router.push({path: '/signout/confirm_pay', query: {templateId: str, from : 'App'}})
            } else{
                str = to.path.slice('/signout/confirm_pay'.length + 1, to.path.length)
                router.push({path: '/signout/confirm_pay', query: {templateId: str}})
            }
        }
      if(to.path.indexOf('/activity/redPacket') > -1 && to.path != '/activity/redPacket'){
          str = to.path.slice('/activity/redPacket'.length + 1, to.path.length)
          router.push({path: '/activity/redPacket', query: {shareRedEnvelopeId: str}})
      }
      console.log(store.state.router)
        if(nativePage.indexOf(to.path) >= 0 && store.state.router.isNewNative){
            Vue.prototype.Interactive.activityWebDismiss()
        }
        next()
    }
})


export default router
